package com.py.message.Impl;
import com.py.message.MessageProducer;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class MessageProducerImpl implements MessageProducer {

    @Resource
    private RabbitTemplate template;

    /**
     * 封装发送消息
     * @param exchange
     * @param routingKey
     * @param msg
     */
    private void send(String exchange,String routingKey,Object msg){
        this.template.convertAndSend(exchange,routingKey,msg);
    }

    @Override
    public void sendMessageDirect(String msg) {

        this.send("Wmsdirect","check",msg);
    }

    @Override
    public void sendMessageDirect2(String msg) {
        this.send("Wmsdirect","kucun",msg);
    }


}
